<template>
  <view class="draw-code">
    <image @click="handleClose" src="@/static/关闭.png" mode="widthFix"></image>
    <view class="code-main">
      <h1>恭喜您获得{{code.length}}个抽奖码</h1>
      <h2><view v-for="item in code" :key="item">{{item}}</view></h2>
      <span>再拿1个抽奖码，中奖概率翻倍哦</span>
      <button v-if="type === 'index'" @click="handleMore">获取更多抽奖码 &gt;</button>
      <button v-else @click="handleClose">我知道了</button>
    </view>
  </view>
</template>

<script>
  export default {
    name:"popup-draw-code",
    props:{
      code:{
        type:Array,
        require:true
      },
      type:{
        type:String,
        default: 'index'
      }
    },
    data() {
      return {
        
      };
    },
    methods:{
      handleClose(){  ///   点击关闭
        this.$emit('on:CLOSE')
      },
      handleMore(){
        this.$emit('on:MORE')
      }
    }
  }
</script>

<style lang="less" scoped>
.draw-code{
  width: 70vw;
  text-align: right;
  uni-image{
    width: 60rpx;
    margin-bottom: 30rpx;
  }
  .code-main{
    background: url('@/static/draw-bg.png') no-repeat;
    background-size: cover;
    text-align: center;
    width: 500rpx;
    height: 476rpx;
    padding-top: 56rpx;
    border-radius: 30rpx;
    box-sizing: border-box;
    h1{
      font-size: 42rpx;
      color: #7d400c;
    }
    h2{
      font-size: 66rpx;
      height: 100rpx;
      overflow-y: auto;
      color: #d43521;
      margin-top: 130rpx;
      margin-bottom: 50rpx;
      display: flex;
      flex-direction: column;
    }
    span{
      font-size: 24rpx;
      color: #95572e;
      font-weight: bold;
    }
    button{
      background: #d43521;
      color: #fff;
      line-height: 80rpx;
      margin: 0 40rpx;
      border-radius: 50rpx;
      margin-top: 20rpx;
    }
  }
}
</style>